package com.foreknow.mapping;

import java.util.HashMap;
import java.util.Map;

public class MappingFactory {
    private  static  MappingFactory mappingFactory =null;
    private Map<String , EntityMapping> maps=new  HashMap<>();
    public  static  final String GUESTBOOK_MAPPING="guestbook";
    public  static  final  String ADMIN_MAPPING="admin";
    // 创建单例
    private MappingFactory(){

    }


    public static MappingFactory getInstance(){
      if (mappingFactory==null){
          mappingFactory =new MappingFactory();
          mappingFactory.maps.put(GUESTBOOK_MAPPING,new GusetbookMapping());
          mappingFactory.maps.put(ADMIN_MAPPING, new AdminMapping());
      }
      return  mappingFactory;
    }

    public  EntityMapping getMap(String key){
        return  maps.get(key);
    }

}
